package behavior.memento;

public class Demo {

    public static void main(String[] args) {
        GameRole gameRole = GameRole.getInitState();
        gameRole.setDef(90);
        // 保存进度
        GameRoleMementoCaretaker.save(gameRole);

        System.out.println("保存的状态:" + gameRole.toString());

        gameRole.setVit(0);

        System.out.println("失败的状态:" + gameRole.toString());

        // 读取存档
        gameRole = GameRoleMementoCaretaker.getGameRole();

        System.out.println("读取的状态: "+gameRole);
    }
}
